Skip to content

fix: Add dark mode support (#42)#3

Open
aidandaly24 wants to merge 7 commits intomainfrom
loopy/issue-42
Open

fix: Add dark mode support (#42)#3
aidandaly24 wants to merge 7 commits intomainfrom
loopy/issue-42

Conversation

@aidandaly24
Copy link
Copy Markdown
Owner

Summary

This PR adds dark mode support to the CLI dashboard. The colors are now configurable and respect system preferences.

Changes

New Features

  • Theme System: Added a comprehensive theme system with light and dark mode color palettes
  • System Detection: Automatically detects system color scheme preference using common environment variables (COLORFGBG, APPLE_INTERFACE_STYLE, TERMINAL_LIGHT_MODE)
  • Manual Override: Users can override the theme via the AGENTCORE_THEME environment variable (light, dark, or system)
  • React Context: Added ThemeProvider and useTheme hook for components to access theme colors

Files Changed

  • src/cli/tui/theme.ts - Expanded with light/dark theme palettes and detection logic
  • src/cli/tui/context/ThemeContext.tsx - New React context for theme management
  • src/cli/tui/context/index.ts - Export new theme context
  • src/cli/tui/App.tsx - Wrapped app with ThemeProvider
  • docs/configuration.md - Added documentation for theme configuration

Tests Added

  • src/cli/tui/__tests__/theme.test.ts - Unit tests for theme functions
  • src/cli/tui/context/__tests__/ThemeContext.test.tsx - Unit tests for ThemeContext

Usage

# Force dark mode
export AGENTCORE_THEME=dark

# Force light mode  
export AGENTCORE_THEME=light

# Auto-detect from system (default)
export AGENTCORE_THEME=system

Backward Compatibility

The existing STATUS_COLORS, INTERACTIVE_COLORS, TEXT_COLORS, and THEME exports are maintained for backward compatibility. They now dynamically return colors based on the current theme mode. These are marked as deprecated in favor of the new useTheme() hook.

Testing

  • Added comprehensive unit tests for theme detection and color selection
  • Added tests for ThemeContext and ThemeProvider
  • Existing tests should continue to pass as backward compatibility is maintained

Closes aws#42

- Add light and dark theme color palettes
- Add system preference detection for automatic theme selection
- Support AGENTCORE_THEME environment variable for manual override
- Maintain backward compatibility with existing color exports
- Create ThemeContext to manage theme state
- Add useTheme hook for accessing theme colors
- Add ThemeProvider component for wrapping the app
- Support system detection and manual theme override
- Add ThemeProvider and useTheme exports
- Wrap app with ThemeProvider for dark mode support
- Theme is automatically detected from system preferences
- Can be overridden via AGENTCORE_THEME environment variable
- Test getThemeColors for light and dark modes
- Test getThemeMode with environment variable
- Test detectSystemTheme with various indicators
- Test theme color palette completeness
- Test useTheme hook returns correct theme colors
- Test ThemeProvider with different initial modes
- Test system detection flag
- Test environment variable override
- Document AGENTCORE_THEME environment variable
- Explain system detection behavior
- Add examples for light, dark, and system modes
@github-actions github-actions Bot added the size/l PR size: L label Mar 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/l PR size: L

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[P0.5] Regenerate AGENTS.md with latest info

1 participant